<p>This rule raises an issue when methods are accessed from empty instances like <code>[]</code> or <code>{}</code> instead of from their prototypes
like <code>Array.prototype</code> or <code>Object.prototype</code>.</p>
<h2>Why is this an issue?</h2>
<p>When you need to "borrow" a method from built-in objects like Array or Object, accessing it through an empty instance is less clear and less
efficient than accessing it directly from the prototype.</p>
<p>Creating empty instances like <code>[]</code> or <code>{}</code> just to access their methods introduces unnecessary object creation. This approach
also makes the code less explicit about the intent - when you see <code>[].slice.apply()</code>, it’s not immediately clear that you’re borrowing the
Array slice method.</p>
<p>Using <code>Array.prototype.slice.apply()</code> instead makes your intent crystal clear: you’re using the Array slice method on some other object.
This pattern is commonly used when working with array-like objects (like <code>arguments</code> or NodeLists) that don’t have Array methods but can
benefit from them.</p>
<p>The prototype approach is also more performant because it avoids creating temporary objects that will need to be garbage collected.</p>
<h3>What is the potential impact?</h3>
<p>This issue affects code readability and performance. While the performance impact is usually minimal, the clarity improvement is significant. Code
that explicitly uses prototypes is easier to understand and maintain, especially for developers who may not be familiar with method borrowing
patterns.</p>
<h3>How to fix?</h3>
<p>Replace empty array instances with Array.prototype when borrowing Array methods.</p>
<h4>Non-compliant code example</h4>
<pre data-diff-id="1" data-diff-type="noncompliant">
const array = [].slice.apply(arrayLike); // Noncompliant
</pre>
<h4>Compliant code example</h4>
<pre data-diff-id="1" data-diff-type="compliant">
const array = Array.prototype.slice.apply(arrayLike);
</pre>
<h3>Documentation</h3>
<ul>
  <li> <a href="https://github.com/sindresorhus/eslint-plugin-unicorn#readme">eslint-plugin-unicorn</a> - Rule <a
  href="https://github.com/sindresorhus/eslint-plugin-unicorn/blob/HEAD/docs/rules/prefer-prototype-methods.md">prefer-prototype-methods</a> </li>
  <li> MDN - Function.prototype.call() - <a
  href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call">Documentation on using call() to invoke
  methods with different contexts</a> </li>
  <li> MDN - Function.prototype.apply() - <a
  href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply">Documentation on using apply() to invoke
  methods with array arguments</a> </li>
  <li> MDN - Array.prototype - <a
  href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/prototype">Documentation on Array prototype methods</a>
  </li>
</ul>
